Kddimitrov/fix worker loader cachable #48
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The worker loader was marked as non cachable - here, which caused a new child compilation and new emit on every change - source here.
When the cache disable is removed initially(after first compilation) the worker files are added as a dependency and watched, because the file dependencies of the child compilation are added to the fileDependencies of the parent compilation - here.
After the first change webpack doesn't find any module dependent on the files and the loader result is cached, so no child compilation is started. This results in that the watcher no longer is even watching the files - source here.
To fix this, we should take all file dependencies of the child compilation and add them to the file dependencies of the module. Now this method will mark the module as one that needs rebuild which will in turn invoke the loader logic.
Fixes #41